import isObject from './isObject'
const nativeCreate = Object.create

function Octor() {}

function createObject(proto) {
  if (!isObject(proto)) return {}
  if (nativeCreate) return nativeCreate(proto)

  Octor.prototype = proto
  const result = new Octor()
  Octor.prototype = null

  return result
}

export default createObject
